home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / PROCED2.MOD < prev    next >
Text File  |  1989-01-18  |  2KB  |  72 lines

  1.                                          (* Chapter 5 - Program 2 *)
  2. MODULE Proced2;
  3.  
  4. FROM InOut IMPORT WriteString, WriteInt, WriteLn;
  5.  
  6. VAR Stuff : INTEGER;
  7.     Thing : INTEGER;
  8.  
  9. PROCEDURE PrintDataOut(Puppy : INTEGER);
  10. BEGIN
  11.    WriteString("The value of Puppy is     ");
  12.    WriteInt(Puppy,5);
  13.    WriteLn;
  14.    Puppy := 12;
  15. END PrintDataOut;
  16.  
  17. PROCEDURE PrintAndModify(VAR Cat : INTEGER);
  18. BEGIN
  19.    WriteString("The value of Cat is       ");
  20.    WriteInt(Cat,5);
  21.    WriteLn;
  22.    Cat := 37;
  23. END PrintAndModify;
  24.  
  25. BEGIN        (* Main program *)
  26.    FOR Stuff := 3 TO 5 DO
  27.       Thing := Stuff;
  28.       PrintDataOut(Thing);
  29.          WriteString("Back from print, data is  ");
  30.          WriteInt(Thing,5);
  31.          WriteLn;
  32.       PrintAndModify(Thing);
  33.          WriteString("Back from modify, data is ");
  34.          WriteInt(Thing,5);
  35.          WriteLn;
  36.       PrintDataOut(Thing);
  37.          WriteString("Back from print, data is  ");
  38.          WriteInt(Thing,5);
  39.          WriteLn;
  40.          WriteLn;
  41.    END;
  42. END Proced2.
  43.  
  44.  
  45.  
  46.  
  47. (* Result of execution
  48.  
  49. The value of Puppy is         3
  50. Back from print, data is      3
  51. The value of Cat is           3
  52. Back from modify, data is    37
  53. The value of Puppy is        37
  54. Back from print, data is     37
  55.  
  56. The value of Puppy is         4
  57. Back from print, data is      4
  58. The value of Cat is           4
  59. Back from modify, data is    37
  60. The value of Puppy is        37
  61. Back from print, data is     37
  62.  
  63. The value of Puppy is         5
  64. Back from print, data is      5
  65. The value of Cat is           5
  66. Back from modify, data is    37
  67. The value of Puppy is        37
  68. Back from print, data is     37
  69.  
  70. *)
  71.  
  72.